<?php
/**********************************************************************//**\file
	Fetch Armory Homepage

	Description:  Displays a list of guild members
*******************************************************************************/

	require_once('core/core.php');

	$page = new armorypage();
	$page->title('Guild Armory - Faceroll Syndicate');

	# Get base URL from config data
	$base_url = $config['base_url'];

	$db = new armorydb();
	$db->query("
		SELECT player_name, player_rank, player_level, player_race, player_gender, player_class,
			player_talents1, player_talents2, player_talents3, player_talents4, player_talents5, player_talents6,
			player_profname1, player_profskill1, player_profname2, player_profskill2
		FROM armory_player
		WHERE player_level = 80
		ORDER BY player_level DESC, player_rank ASC, player_name ASC
	");
	$members = $db->multi_result();

	$page->add('<table id="roster">
	<tr>
		<th>Name</th>
		<th>Rank</th>
		<th>Level</th>
		<th>Race</th>
		<th>Class</th>
		<th colspan="2">Talents</th>
		<th colspan="4">Professions</th>
	</tr>');

	# Initialize localization / UI
	$ui = new armoryui();

	$rowalt = true;
	foreach($members as $var)
	{
		#var_dump($var);
		if($rowalt)
		{
			$page->add('<tr class="alt">');
		}
		else
		{
			$page->add('<tr>');
		}

		$page->add('
			<td class="name">'.$ui->player_name($var['player_name']).'</td>
			<td>'.$ui->player_rank($var['player_rank']).'</td>
			<td class="t1">'.$var['player_level'].'</td>
			<td>'.$ui->player_race_img($var['player_race'], $var['player_gender']).'</td>
			<td>'.$ui->player_class_img($var['player_class']).'</td>
			<td class="t1">'.$ui->player_talents($var['player_class'], $var['player_talents1'], $var['player_talents2'], $var['player_talents3']).'</td>
			<td>'.$ui->player_talents($var['player_class'], $var['player_talents4'], $var['player_talents5'], $var['player_talents6']).'</td>
			<td class="prof">'.$ui->player_profession_img($var['player_profname1']).' '.$var['player_profskill1'].'</td>
			<td>'.$ui->player_profession_img($var['player_profname2']).' '.$var['player_profskill2'].'</td>
		</tr>');

		$rowalt = !$rowalt;
	}

	$page->add('</table>');

	$page->output();
?>